import Router from 'koa-router';
import { dmDB, kingbaseDB } from '../../utils/database.js';

const router = new Router();

// 获取数据源列表
router.get('/list', async (ctx) => {
  try {
    const result = await dmDB.query('SELECT * FROM your_table');
    ctx.success(result);
  } catch (err) {
    ctx.error('获取列表失败：' + err.message);
  }
});

// 获取数据源状态
router.get('/status', async (ctx) => {
  try {
    const result = await kingbaseDB.query('SELECT * FROM status_table');
    ctx.success(result);
  } catch (err) {
    ctx.error('获取状态失败：' + err.message);
  }
});

export default router; 